<template>
  <div>
    <!-- 里面只能有一个组件,通过include指定缓存组件，也可呀通过exclude排除 max指定缓存的数量-->
    <keep-alive :include="['Login']" :max=10>
      <Login v-if="flag"></Login>
      <Reg v-else></Reg>
    </keep-alive>
    <button @click="flag = !flag">切换</button>
    <!-- <HelloWorldVue></HelloWorldVue> -->
  </div>
</template>

<script setup lang="ts">
import Login from './components/login/index.vue'
import Reg from './components/reg/index.vue'
import { ref } from 'vue';
const flag = ref(true)
</script>

